#include <bits/stdc++.h>
using namespace std;
int n, k, mass[16100000];
int a[3000], b[3000];
set<int> ans;
const int step = 8000001;
int main() {
  ios_base::sync_with_stdio(false);
  int i, j;
  cin >> k >> n;
  for (i = 1; i <= k; i++) cin >> a[i];
  for (i = 1; i <= n; i++) cin >> b[i];
  for (i = 1; i <= k; i++) {
    int curr = b[1];
    for (j = i + 1; j <= k; j++) {
      curr += a[j];
      mass[curr + step] = i;
    }
    curr = b[1];
    for (j = i; j >= 2; j--) {
      curr -= a[j];
      mass[curr + step] = i;
    }
    curr -= a[1];
    bool f = true;
    for (j = 2; j <= n; j++)
      if (mass[b[j] + step] != i) {
        f = false;
        break;
      }
    if (f) ans.insert(curr);
  }
  cout << ans.size();
  return 0;
}
