#include <stdio.h>
#define Nmax 50 //テヲツ慊ュテ」ツ?ョテヲツ楪堙ヲツ閉ー
#define Rmax 50 //テ」ツつォテ」ツδε」ツδ暗・ツ崢榲ヲツ閉ー

int main (void){
    int deck[Nmax];
    int tmp[Nmax];
    int n, r;
    int p,c;
    int i,j;
    
    while(1){
        //テ・ツ按敕ヲツ慊淌・ツ個?
        for(i=0;i<Nmax;i++){
            deck[i]=0;
            tmp[i]=0;
        }
        n = r = p = c = 0;
        
        //テ・ツ?・テ・ツ環?
        scanf("%d %d", &n, &r);
        if(!n && !r)
            break;
        for(i=0;i<r;i++)
            scanf("%d %d", &p, &c);
        for(i=0;i<n;i++){
            deck[i] = n-i;
        }
        /*テ・ツ?ヲテァツ青?
         deck[p-1]テヲツ楪堙ァツ崢ョテ」ツ?凝」ツつ営テヲツ楪堙」ツつ稚mpテ」ツ?ォテ・ツ渉偲」ツつ?」ツ?‥eck[0]~deck[(p-1)-1]テ」ツつ団テ」ツ??」ツ?妥、ツクツ凝」ツ?ォテ、ツソツ敕・ツュツ?
         tmpテ」ツ?凝」ツつ嘉ヲツ個?」ツ?」テ」ツ?ヲテ」ツ?湘」ツつ?
         テァツケツーテ」ツつ甘ィツソツ氾」ツ??
        */
        for(i=0;i<c;i++){
            tmp[i] = deck[p-1+i];
            deck[p-1+i] = deck[i];
            deck[i] = tmp[i];
        }
        deck[0]++;//テ・ツ伉佚ィツァツ」テヲツウツ?
        printf("%d\n",deck[0]);
    }
    return 0;
}