#include <bits/stdc++.h>
using namespace std;
int a[2005], b[2005];
int ban[2005];
int main() {
  int k, n;
  cin >> k >> n;
  for (int tmp = 0; tmp < k; tmp++) {
    int x;
    cin >> x;
    if (tmp != 0)
      a[tmp] = a[tmp - 1] + x;
    else
      a[tmp] = x;
  }
  sort(a, a + k);
  int idx = 1;
  ban[0] = a[0];
  for (int tmp = 1; tmp < k; tmp++) {
    if (a[tmp] != a[tmp - 1]) {
      ban[idx] = a[tmp];
      idx++;
    }
  }
  for (int tmp = 0; tmp < n; tmp++) {
    cin >> b[tmp];
  }
  sort(b, b + n);
  int cnt = 0;
  for (int tmp = 0; tmp < idx; tmp++) {
    int pos = 1;
    int tadi = tmp;
    bool bisa = true;
    for (int sem = tmp + 1; sem < idx; sem++) {
      if (pos == n) break;
      if (ban[sem] - ban[tadi] == b[pos] - b[pos - 1]) {
        pos++;
        tadi = sem;
      } else if (ban[sem] - ban[tadi] > b[pos] - b[pos - 1]) {
        bisa = false;
        break;
      }
    }
    if (bisa && pos == n) {
      cnt++;
    }
  }
  cout << cnt << "\n";
}
