#include <bits/stdc++.h>
using namespace std;
int n, m, Min, Max, i, len, f;
char s1[55], s[55];
int main() {
  scanf("%d%d", &n, &m);
  getchar();
  Min = 1;
  Max = n;
  while (m--) {
    scanf("%s%s%s%s%d", s, s, s1, s, &f);
    if (s1[0] == 'l')
      Max = min(f - 1, Max);
    else if (s1[0] == 'r')
      Min = max(f + 1, Min);
  }
  if (Min > Max)
    puts("-1");
  else
    printf("%d\n", Max - Min + 1);
  return 0;
}
