#include <bits/stdc++.h>
bool isNone[1000];
int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    char way[6];
    int tar;
    scanf("%*s %*s %s %*s %d", way, &tar);
    tar--;
    if (way[0] == 'r') {
      for (int j = 0; j <= tar; j++) isNone[j] = true;
    } else {
      for (int j = tar; j < n; j++) isNone[j] = true;
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (!isNone[i]) cnt++;
  }
  if (cnt == 0)
    printf("-1\n");
  else
    printf("%d\n", cnt);
  return 0;
}
