#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T sqr(T t) {
  return t * t;
}
inline void files() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int n, k, a[2100], b[2100], sum[2100];
map<int, int> mp1;
int main() {
  files();
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) {
    sum[i] = (sum[i - 1] + a[i]);
    mp1[(b[1] - sum[i])] = 1;
  }
  int ans = 0;
  for (map<int, int>::iterator it = mp1.begin(); it != mp1.end(); it++) {
    int num = it->first;
    map<int, int> used;
    for (int i = 1; i <= n; i++) {
      used[num + sum[i]] = 1;
    }
    bool bb = 1;
    for (int i = 1; i <= k; i++)
      if (!used[b[i]]) {
        bb = 0;
        break;
      }
    if (bb) ans++;
  }
  cout << ans;
}
