#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  char a1[5], a2[5], a3[5], a4[5];
  scanf("%d%d", &n, &m);
  int leftnum = 0;
  int rightnum = 0;
  int left[1005], right[1005];
  left[0] = n + 1;
  right[0] = 0;
  for (int i = 1; i <= m; i++) {
    scanf("%s%s%s%s", a1, a2, a3, a4);
    if (strcmp(a3, "left") == 0) {
      scanf("%d", &left[++leftnum]);
    } else {
      scanf("%d", &right[++rightnum]);
    }
  }
  int minleft = 99999999, maxright = 0;
  for (int i = 0; i <= leftnum; i++) {
    if (left[i] < minleft) {
      minleft = left[i];
    }
  }
  for (int i = 0; i <= rightnum; i++) {
    if (right[i] > maxright) {
      maxright = right[i];
    }
  }
  if (minleft - 1 <= maxright) {
    printf("-1\n");
  } else {
    printf("%d\n", minleft - maxright - 1);
  }
  return 0;
}
