#include <bits/stdc++.h>
using namespace std;
int main() {
  int ok[1010], n, in_left, num, m, l;
  char c;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) ok[i] = 1;
  while (m > 0) {
    m--;
    in_left = 1;
    c = 'a';
    while (c < '0' || '9' < c) {
      scanf("%c", &c);
      if (c == 'r') in_left = -1;
    }
    num = c - '0';
    scanf("%c", &c);
    while ('0' <= c && c <= '9') {
      num = num * 10 + c - '0';
      scanf("%c", &c);
    }
    if (in_left == 1)
      for (int i = num; i <= n; i++) ok[i] = -1;
    else
      for (int i = num; i >= 1; i--) ok[i] = -1;
  }
  num = 0;
  for (int i = 1; i <= n; i++)
    if (ok[i] == 1) num++;
  if (num == 0)
    printf("-1");
  else
    printf("%d", num);
  return 0;
}
