#include <bits/stdc++.h>
template <class t>
void maxi(t &x, t y) {
  if (x < y) x = y;
}
template <class t>
void mini(t &x, t y) {
  if (x > y) x = y;
}
using namespace std;
long long n, k, a[30005], b[30005];
bool vis[8000006];
set<long long> fa;
bool find(long long x) {
  int in = lower_bound(b, b + n, x) - b;
  return in < n && b[in] == x;
}
bool match(int in) {
  long long ad = b[0] - a[in];
  int cnt = 0;
  for (int(i) = 0; (i) < (k); (i)++) {
    vis[a[i] + ad + 4000000] = true;
  }
  int ans = true;
  for (int(i) = 0; (i) < (n); (i)++)
    if (!vis[b[i] + 4000000]) {
      ans = false;
      break;
    }
  if (ans) fa.insert(ad);
  for (int(i) = 0; (i) < (k); (i)++) {
    vis[a[i] + ad + 4000000] = false;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(0);
  cout << setprecision(10) << fixed;
  cin >> k >> n;
  for (int(i) = 0; (i) < (k); (i)++) cin >> a[i];
  for (int(i) = 1; (i) <= (k - 1); (i)++) a[i] += a[i - 1];
  for (int(i) = 0; (i) < (n); (i)++) cin >> b[i];
  sort(b, b + n);
  int ans = 0;
  for (int(i) = 0; (i) < (k); (i)++)
    if (match(i)) ans++;
  cout << fa.size() << endl;
  return 0;
}
