#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int k, n, b[2001], s = 0, ans = 0;
  cin >> k >> n;
  set<int> S;
  for (int i = 0; i < k; ++i) {
    int a;
    cin >> a;
    s += a;
    S.insert(s);
  }
  vector<int> v;
  for (auto ss : S) v.push_back(ss);
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  sort(b, b + n);
  for (int i = 1; i < n; ++i) b[i] -= b[0];
  for (int i = 0; i < v.size() - n + 1; ++i) {
    int j;
    set<int> S2;
    for (int j = 1; j < v.size(); ++j) S2.insert(v[j] - v[i]);
    for (j = 1; j < n; ++j) {
      if (S2.count(b[j]) == 0) break;
    }
    ans += j == n;
  }
  cout << ans << endl;
  return 0;
}
