#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
map<int, int>::iterator it;
int arr[2005];
int main() {
  int i, j, n, k, a, b, p = 0;
  cin >> k >> n;
  for (i = 0; i < k; i++) cin >> arr[i];
  for (i = 1; i <= n; i++) {
    cin >> b;
    for (j = 0; j < k; j++) {
      b -= arr[j];
      if (m[b] == i - 1) m[b] = i;
    };
  };
  for (it = m.begin(); it != m.end(); ++it)
    if (it->second == n) p++;
  cout << p << endl;
  return 0;
};
