#include <bits/stdc++.h>
int A[1001];
bool B[1001];
int map[1001];
int main() {
  int n, m;
  char s[100], buf[100];
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%s %s %s %s %d", buf, buf, s, buf, &A[i]);
    if (s[0] == 'r') B[i] = 1;
  }
  int lend = 1, rend = n;
  bool flag = false;
  for (int i = 0; i < m; i++) {
    if (B[i]) {
      if (A[i] + 1 >= lend) {
        if (A[i] + 1 <= rend)
          lend = A[i] + 1;
        else {
          flag = true;
          break;
        }
      }
    } else {
      if (A[i] - 1 <= rend) {
        if (A[i] - 1 >= lend)
          rend = A[i] - 1;
        else {
          flag = true;
          break;
        }
      }
    }
  }
  if (flag)
    printf("-1\n");
  else
    printf("%d\n", rend - lend + 1);
  return 0;
}
