#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, m, n;
  int a[1001];
  char s[1000], c;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(a, 0, sizeof(a));
    while (m--) {
      scanf("%s", s);
      scanf("%s", s);
      scanf("%s", s);
      c = s[0];
      scanf("%s", s);
      scanf("%d", &k);
      if (c == 'r') {
        for (i = 1; i <= k; i++) a[i] = 1;
      } else {
        for (i = k; i <= n; i++) a[i] = 1;
      }
    }
    k = 0;
    for (i = 1; i <= n; i++)
      if (a[i] == 0) k++;
    if (k == 0)
      printf("-1\n");
    else
      printf("%d\n", k);
  }
}
