#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> k >> n;
  vector<int> sum(k + 1), start(n);
  for (int i = 1; i <= k; i++) {
    cin >> sum[i];
    sum[i] += sum[i - 1];
  }
  for (int i = 0; i < n; i++) {
    cin >> start[i];
  }
  set<int> s;
  for (int i = 1; i <= k; i++) {
    s.insert(start.front() - sum[i]);
  }
  int ans = 0;
  for (auto p : s) {
    set<int> point;
    for (int i = 1; i <= k; i++) {
      point.insert(p + sum[i]);
    }
    bool flag = true;
    for (int d : start) {
      flag &= point.count(d);
    }
    ans += flag;
  }
  cout << ans;
  return 0;
}
