#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n, k;
  cin >> n >> k;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long b[k];
  for (long long i = 0; i < k; i++) {
    cin >> b[i];
  }
  unordered_map<long long, long long> mp, ans;
  for (long long i = 0; i < k; i++) {
    mp.clear();
    for (long long j = 0; j < n; j++) {
      b[i] -= a[j];
      mp[b[i]]++;
      if (mp[b[i]] == 1) {
        ans[b[i]]++;
      }
    }
  }
  long long res = 0;
  for (auto i : ans) {
    if (i.second >= k) res++;
  }
  cout << res << endl;
}
