#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int n, k, a[N], b[N];
set<int> cnt;
int main() {
  ios::sync_with_stdio(0);
  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];
  int res = 0;
  set<int> has;
  for (int i = 1; i <= k; i++) {
    int val = b[1] - a[i];
    if (has.count(val)) continue;
    set<int> ss;
    for (int j = 1; j <= n; j++) ss.insert(b[j]);
    for (int i = 1; i <= k; i++) ss.erase(val + a[i]);
    res += ss.size() == 0;
    has.insert(val);
  }
  cout << res;
  return 0;
}
