#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int d;
  cin >> n >> d;
  int result = 0;
  int cur = 0;
  for (int t = 0; t < d; t++) {
    string s;
    cin >> s;
    bool f = true;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == '0') f = false;
    }
    if (!f) {
      cur++;
      if (cur > result) result = cur;
    } else
      cur = 0;
  }
  cout << result;
}
