// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):x)
#define uint unsigned int
#define dbl long double
using namespace std;
// mylittledoge
int main() {
cin.sync_with_stdio(0);
cin.tie(0);
int N,K,a;
cin >> N >> K;
multiset<int> S1,P;
for(int i =0; i < N; i++) {
cin >> a;
S1.insert(a);} // 5*a
for(int i =0; i < K; i++) {
cin >> a;
P.insert(a);} // 5*a
int ans =N;
while(!S1.empty()) {
if(P.empty()) {cout << "NIE\n"; return 0;}
a =*S1.rbegin();
S1.erase(--S1.end());
if(*P.rbegin() >= 5*a) {
P.erase(--P.end());
continue;}
ans++;
auto it =P.lower_bound(3*a);
if(it == P.end()) {cout << "NIE\n"; return 0;}
P.erase(it);
it =P.lower_bound(2*a);
if(it == P.end()) {cout << "NIE\n"; return 0;}
P.erase(it);}
cout << ans << "\n";
return 0;}
// look at my code
// my code is amazing
Ly8gaW9zdHJlYW0gaXMgdG9vIG1haW5zdHJlYW0KI2luY2x1ZGUgPGNzdGRpbz4KLy8gYml0Y2ggcGxlYXNlCiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxxdWV1ZT4KI2luY2x1ZGUgPHN0YWNrPgojaW5jbHVkZSA8bGlzdD4KI2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8aW9tYW5pcD4KI2RlZmluZ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