#include using namespace std; int main() { int k, n; cin >> k >> n; int a[n], b[n]; for(int i = 0; i < n; i++) { cin >> a[i]; } for(int i = 0; i < n; i++) { cin >> b[i]; } vector cnt1(101, 0), cnt2(101, 0); for(int i = 0; i < n; i++) { cnt1[a[i]]++; cnt2[b[i]]++; } long long res = 0; for(int i = 0; i <= 100; i++) { long long c = 0; for(int j = 0; j <= 100; j++) { if(i + j >= k) { c += cnt2[j]; } } res += c * cnt1[i]; } cout << res << endl; return 0; }