#include <bits/stdc++.h>
using namespace std;
int FindPos(const vector<int> &vec, int x) {
  int left = 0, right = vec.size() - 1;
  while (left < right) {
    int mid = left + (right - left) / 2;
    if (vec[mid] == x) {
      left = right = mid;
    } else if (vec[mid] > x) {
      right = mid - 1;
    } else {
      left = mid + 1;
    }
  }
  return (left == right && vec[left] == x) ? left : (-1);
}
bool GoodFirstSum(int sum, const vector<int> &mods, const vector<int> &help) {
  vector<bool> used(help.size(), false);
  int left = help.size();
  int missing = 0;
  for (int mod : mods) {
    int needed = sum + mod;
    int pos = FindPos(help, needed);
    if (pos != -1 && !used[pos]) {
      used[pos] = true;
      --left;
    } else {
      ++missing;
    }
    if (left <= 0 || missing + left > (int)mods.size()) {
      break;
    }
  }
  return left <= 0;
}
set<int> Solve(const vector<int> &marks, const vector<int> &states) {
  set<int> options;
  for (int mark : marks) {
    int sum = states[0] - mark;
    if (GoodFirstSum(sum, marks, states)) {
      options.insert(sum);
    }
  }
  return options;
}
int main() {
  int judges, remembered;
  cin >> judges >> remembered;
  vector<int> marks(judges);
  for (int i = 0; i < judges; ++i) {
    cin >> marks[i];
    if (i > 0) {
      marks[i] += marks[i - 1];
    }
  }
  vector<int> states(remembered);
  for (int &sum : states) {
    cin >> sum;
  }
  sort(states.begin(), states.end());
  auto options = Solve(marks, states);
  cout << options.size() << "\n";
  return 0;
}
