#include <bits/stdc++.h>
using namespace std;
long long n, k, a[2005], b[2005], x, y;
vector<long long> v;
set<long long> ans;
map<long long, long long> m;
void check(long long x) {
  for (__typeof((n + 1)) i = (1); i < (n + 1); i++) {
    if (!m[b[i]]) return;
  }
  ans.insert(x);
}
void solve() {
  cin >> k >> n;
  for (__typeof((k + 1)) i = (1); i < (k + 1); i++)
    cin >> a[i], a[i] += a[i - 1], v.push_back(a[i]);
  for (__typeof((n + 1)) i = (1); i < (n + 1); i++) cin >> b[i];
  for (auto i : v) {
    m.clear();
    x = b[1] - i;
    for (auto j : v) m[x + j]++;
    check(x);
  }
  {
    cout << (long long)ans.size() << "\n";
    return;
  };
}
void prep() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  prep();
  cout << fixed << setprecision(12);
  while (t--) solve();
  return 0;
}
