Healthy volunteers
Not accepted
Inclusion Criteria: - Male or female, age at least 18 years at the time of signing inform consent. For Japan: Male or female, age at least 20 years at the time of signing informed consent - Subjects diagnosed with T2DM (type 2 diabetes mellitus) and on stable diabetes treatment (plus/minus 20 percent change in total daily dose) with basal insulin (minimum of 0.25 IU/kg/day and/or 20 IU/day of: insulin glargine, insulin detemir, insulin degludec and/or NPH insulin) alone or in combination with metformin (minimum of 1500 mg/day or maximal tolerable dose) for 90 days prior to screening - HbA1c (glycosylated haemoglobin) 7.0 - 10.0 percent (53 - 86 mmol/mol) both inclusive Exclusion Criteria: - Female who is pregnant, breast-feeding or intends to become pregnant or is of child-bearing potential and not using an adequate contraceptive method throughout the trial including the 5 weeks follow-up period (adequate contraceptive measures as required by local regulation or practice). Germany: Only highly effective methods of birth control are accepted (ie one that results in less than 1% per year failure rate when used consistently and correctly such as implants, injectables, combined oral contraceptives, some intrauterine device), or sexual abstinence or vasectomised partner. Japan: Adequate contraceptive measures are abstinence (not having sex), diaphragm, condom (by the partner), intrauterine device, sponge, spermicide or oral contraceptives - Treatment with any glucose lowering agents other than stated in the inclusion criteria in a period of 90 days before screening. An exception is short-term treatment (7 days or less in total) with bolus insulin in connection with intercurrent illness - Experienced more than 3 episodes of severe hypoglycaemia within 6 months prior to screening, and/or hypoglycaemia unawareness - History of pancreatitis (acute or chronic) - Screening calcitonin value above or equal to 50 ng/L (pg/mL) - Personal or family history of medullary thyroid carcinoma (MTC) or multiple endocrine neoplasia syndrome 2 (MEN 2) - Severe renal impairment defined as eGFR (estimated glomerular filtration rate) below 30 mL/min/1.73 m\^2 per Modification of Diet in Renal Disease (MDRD) formula (4 variable version) - Acute coronary or cerebrovascular event within 90 days before randomisation - Heart failure, New York Heart Association (NYHA) Class IV