#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
#include<stdio.h>

int main()
{
  FILE *p,*f;
  unsigned char *s;
  int k,n,m=0;
  int i=0,j,b=0,b1=0;
  scanf("%d %d",&k,&n);
  if(k<=0 || n<=0)
  {
     printf("-1");
     exit(1);
  }
  p=fopen("ulaz.txt","r");
  f=fopen("izlaz.txt","w");
   if(p==NULL || f==NULL)
     {
     printf("-1");
     exit(1);
      }
 while((fscanf(p,"%s",s))!=EOF)
 {
   i++;
   if(i==k)
   {
     for(j=0;s[j]!='\0';j++)
	  b++;
     for(j=0;j<b;j++,b1++)
      {
	  if(b1==n-1)
	  {
	    s[b1]=s[n+1];
	    b1=0;
	    m++;
	    
	  }
      }
      b=b-m;
     fprintf(f,"%s",s);
   }
  }
   fclose(p);
   fclose(f);
 }