#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
using namespace std;

class Stack {
public:
  int stack[10000]{};
  int top;

  Stack() : top(0) {}
  void push(int idx) { stack[top++] = idx; }
  int pop() {
    int p = stack[--top];
    return p;
  }
};

int main() {
  fastIO;

  Stack st;
  int n, k;
  string s;
  cin >> n >> k >> s;

  for (int i = 0; i < n; ++i) {
    if (s[i] == '(') {
      st.push(i + 1);
    } else {
      int idx = st.pop();
      if (idx == k) {
        cout << i + 1 << '\n';
      } else if (i + 1 == k) {
        cout << idx << '\n';
      }
    }
  }

  return 0;
}