#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n;
  cin >> k >> n;
  vector<int> a(k);
  vector<int> b(n);
  for (int i = 0; i < k; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  for (int i = 1; i < k; ++i) {
    a[i] += a[i - 1];
  }
  set<int> usd;
  for (int i = 0; i < a.size(); ++i) {
    usd.insert(a[i]);
  }
  int res = 0;
  for (int x : usd) {
    int df = b[0] - x;
    bool ok = true;
    for (int j = 1; j < n; ++j) {
      if (!usd.count(b[j] - df)) {
        ok = false;
        break;
      }
    }
    res += ok;
  }
  cout << res << endl;
  return 0;
}
