#include <bits/stdc++.h>
using namespace std;
string M[200];
int main() {
  int n, d;
  while (cin >> n >> d) {
    for (int i = 0; i < d; i++) cin >> M[i];
    int ans = 0;
    int c = 0;
    for (int i = 0; i < d; i++) {
      bool sw = 0;
      for (int j = 0; j < n; j++) {
        if (M[i][j] == '0') {
          sw = 1;
          break;
        }
      }
      if (sw) {
        c++;
      } else {
        c = 0;
      }
      ans = max(ans, c);
    }
    cout << ans << "\n";
  }
  return 0;
}
