#include <bits/stdc++.h>
using namespace std;
set<int> can[2005];
int n, k;
int f[2005], b[2005];
int main() {
  cin >> k >> n;
  for (int i = 1; i <= k; i++) {
    int x;
    cin >> x;
    f[i] = f[i - 1] + x;
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    for (int j = 1; j <= k; j++) {
      can[i].insert(b[i] - f[j]);
    }
  }
  int ans = 0;
  set<int>::iterator it;
  for (it = can[1].begin(); it != can[1].end(); it++) {
    int ok = 1;
    int initial = *it;
    for (int i = 2; i <= n; i++) {
      set<int>::iterator it1;
      it1 = can[i].lower_bound(initial);
      if (it1 == can[i].end()) {
        ok = 0;
        break;
      }
      if (*it1 != initial) {
        ok = 0;
        break;
      }
      if (i == n) ok = 1;
    }
    if (ok) ans++;
  }
  cout << ans;
}
