#include <bits/stdc++.h>
using namespace std;
unordered_map<int, int> mp;
unordered_map<int, bool> vis;
int a[2005], b[2005];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int k, n;
  cin >> k >> n;
  for (int i = 1; i <= k; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i < n; i++) {
    vis.clear();
    for (int j = 1; j <= k; j++) {
      int x = b[i] - a[j];
      if (!vis[x]) {
        mp[x]++;
        vis[x] = true;
      }
    }
  }
  vis.clear();
  int ans = 0;
  for (int i = 1; i <= k; i++) {
    int x = b[n] - a[i];
    if (!vis[x]) {
      vis[x] = true;
      if (mp[x] == n - 1) ans++;
    }
  }
  cout << ans;
}
