#include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
struct node* next;
};
int main()
{
int m,n;
cin>>m>>n;
struct node *p,*q,*head,*t,*b;
head=NULL;
for(int i=1;i<=m;i++)
{
p=(struct node *)malloc(sizeof(struct node));
p->data=i;
p->next=NULL;
if(head==NULL) head->next=p;
else q->next=p;
q=p;
}
t=head;
while(t!=NULL)
{
if(t->data==n)
{
cout<<t->data;
b->next=t->next;
t=head;
}
b=t;
if(t->data!=n) t=t->next;
}
return 0;
}