#include <bits/stdc++.h>
using namespace std;
int val[1025], q[1000005];
int L = 1, R = 0;
int vis[1025];
int n, k, sz;
int query(int y) {
  if (!y) {
    puts("R");
    fflush(stdout);
    return 0;
  } else {
    sz++;
    assert(sz <= (3 * n * n) / (2 * k));
    printf("? %d\n", y);
    fflush(stdout);
    char str[5];
    scanf("%s", str);
    return (str[0] == 'Y');
  }
}
vector<int> solve(int l, int r) {
  if (r - l + 1 == k) {
    vector<int> vt;
    for (int i = l; i <= r; i++)
      if (!query(i)) vt.push_back(i);
    query(0);
    return vt;
  }
  int m = ((l + r) >> 1);
  vector<int> a = solve(l, m);
  vector<int> b = solve(m + 1, r);
  bool cur[1025];
  memset(cur, 0, sizeof(cur));
  for (int i = 0; i < a.size(); i += k)
    for (int j = 0; j < b.size(); j += k) {
      if (i + k - 1 >= a.size() || j + k - 1 >= b.size()) {
        for (int l = i; l < i + (k >> 1) && l < a.size(); l++) query(a[l]);
        for (int l = j; l < j + (k >> 1) && l < b.size(); l++)
          if (query(b[l])) cur[b[l]] = 1;
        query(0);
        for (int l = i; l < i + (k >> 1) && l < a.size(); l++) query(a[l]);
        for (int l = j + (k >> 1); l < j + k && l < b.size(); l++)
          if (query(b[l])) cur[b[l]] = 1;
        query(0);
        for (int l = i + (k >> 1); l < i + k && l < a.size(); l++) query(a[l]);
        for (int l = j; l < j + (k >> 1) && l < b.size(); l++)
          if (query(b[l])) cur[b[l]] = 1;
        query(0);
        for (int l = i + (k >> 1); l < i + k && l < a.size(); l++) query(a[l]);
        for (int l = j + (k >> 1); l < j + k && l < b.size(); l++)
          if (query(b[l])) cur[b[l]] = 1;
        query(0);
      } else {
        for (int l = i; l < i + (k >> 1); l++) query(a[l]);
        for (int l = j; l < j + (k >> 1); l++)
          if (query(b[l])) cur[b[l]] = 1;
        for (int l = i + (k >> 1); l < i + k; l++)
          if (query(a[l])) cur[a[l]] = 1;
        for (int l = j + (k >> 1); l < j + k; l++)
          if (query(b[l])) cur[b[l]] = 1;
        for (int l = i; l < i + (k >> 1); l++)
          if (query(a[l])) cur[a[l]] = 1;
        query(0);
      }
    }
  vector<int> vt;
  for (int i = 0; i < a.size(); i++)
    if (!cur[a[i]]) vt.push_back(a[i]);
  for (int i = 0; i < b.size(); i++)
    if (!cur[b[i]]) vt.push_back(b[i]);
  return vt;
}
int main() {
  scanf("%d%d", &n, &k);
  if (k == 1) {
    int s = 0;
    for (int i = 1; i <= n; i++) {
      bool ok = 1;
      for (int j = i + 1; j <= n; j++) {
        query(i);
        if (query(j)) ok = 0;
        query(0);
        if (!ok) break;
      }
      s += ok;
    }
    printf("! %d\n", s);
    fflush(stdout);
    return 0;
  }
  vector<int> ans = solve(1, n);
  printf("! %d\n", (int)ans.size());
  fflush(stdout);
  return 0;
}
