#include <bits/stdc++.h>
char s[2], s1[3], s2[5], s3[2];
int main() {
  int n, m, i, j, f, r, flag;
  scanf("%d %d", &n, &m);
  f = 1;
  r = n;
  flag = 0;
  for (j = 0; j < m; j++) {
    scanf("%s %s %s %s %d", s, s1, s2, s3, &i);
    if (s2[0] == 'l' && i > f) {
      if (i > r)
        r;
      else
        r = i - 1;
    } else if (s2[0] == 'r' && i < r) {
      if (i < f)
        f = f;
      else
        f = i + 1;
    } else {
      flag = 1;
      break;
    }
  }
  if (flag == 1)
    printf("-1\n");
  else
    printf("%d\n", r - f + 1);
}
