'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', function(inputStdin) {
    inputString += inputStdin;
});

process.stdin.on('end', function() {
    inputString = inputString.split('\n');

    main();
});

function readline() {
    return inputString[currentLine++];
}


function main() {

    var k = readline().split(' ').map(x => parseInt(x))
    var n = k[0], m = k[1]
    
    if(m % n == 0) console.log(n + m)
    else console.log(n - m)
}