#include <bits/stdc++.h>
using namespace std;
bool comp(int a, int b) { return (a < b); }
int max(int a, int b) {
  if (a > b) return a;
  return b;
}
long long power(long long a, int x) {
  while (x--) {
    a *= a;
  }
  return a;
}
int checks(const set<int>& ch, const set<int>& poss) {
  for (int z : ch)
    if (poss.find(z) == poss.end()) return 0;
  return 1;
}
int main() {
  int n, k, ans = 0;
  set<int> c, ch, poss;
  cin >> k >> n;
  vector<int> sum(k), m(k), p(n);
  for (int i = 0; i < k; i++) cin >> m[i];
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    ch.insert(p[i]);
  }
  sum[0] = m[0];
  for (int i = 1; i < k; i++) sum[i] = sum[i - 1] + m[i];
  for (int i = 0; i < k; i++) {
    c.insert(p[0] - sum[i]);
  }
  for (int x : c) {
    poss.clear();
    for (int i = 0; i < k; i++) poss.insert(x + sum[i]);
    ans += checks(ch, poss);
  }
  cout << ans;
}
