#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

typedef unsigned long long ull;

typedef long long ll;

const int P = 239017;
struct num {
  static const int MA = 1e9 + 7, MB = 1e9 + 9; // ~10^{18}

  int a, b;

  num() { }
  num( int x ) : a(x), b(x) { }
  num( int _a, int _b ) : a(_a), b(_b) { }

  num operator + ( const num &x ) const { return num((a + x.a) % MA, (b + x.b) % MB); }
  num operator - ( const num &x ) const { return num((a + MA - x.a) % MA, (b + MB - x.b) % MB); }
  num operator * ( int x ) const { return num(((ll)a * x) % MA, ((ll)b * x) % MB); }
  num operator * ( const num &x ) const { return num(((ll)a * x.a) % MA, ((ll)b * x.b) % MB); }
  bool operator == ( const num &x ) const { return a == x.a && b == x.b; }

  explicit operator ll () const { return (ll)a * MB + b + 1; } // > 0
};

int main() {
  int n, k;
  cin >> n >> k;
  int N = 2 * n;
  int a[N];
  forn(i, n) 
    cin >> a[i];
  forn(i, n) 
    a[n + i] = a[n - i - 1];

  num h[N + 1], deg[N + 1];
  deg[0] = 1, h[0] = 0; // [l..r] --> h[r+1] - h[l]
  forn(i, N) {
    deg[i + 1] = deg[i] * P;
    h[i + 1] = h[i] * P + a[i];
    /** h[i] = s[0]*P^{i-1} + s[1]*P^{i-2} + .. + s[i-1]*P^0 */
  }
  auto substrHash = [&]( int l, int r ) { // [l, r)
    return h[r] - h[l] * deg[r - l];
  };

  /** N = 2 * n */
  for (int i = 0; i <= n; i += 2)
    if (substrHash(0, i) == substrHash(N - i, N))
      printf("%d ", n - i / 2);
}